/**
 * Copyright &copy; 2018-2018 <a href="#">聚成科技</a> All rights reserved.
 */
package com.jckj.core.service.impl;

import com.jckj.core.annotation.CurrentDataSource;
import com.jckj.core.dao.NotifyAttachmentViewMapper;
import com.jckj.core.db.DataSourceEnum;
import com.jckj.core.entity.NotifyAttachmentView;
import com.jckj.core.entity.NotifyAttachmentViewExample;
import com.jckj.core.exception.ServiceException;
import com.jckj.core.service.NotifyAttachmentViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author :liukuan
 * @date :2018-02-07
 */
@Service
@Transactional(readOnly = true,rollbackFor = ServiceException.class)
public class NotifyAttachmentViewServiceImpl implements NotifyAttachmentViewService {

    @Autowired
    private NotifyAttachmentViewMapper notifyAttachmentViewMapper;
    /**
     * 根据公告notifyId查询相关的附件信息
     *
     * @param notifyId
     * @return
     */
    @Override
    @CurrentDataSource(DataSourceEnum.SLAVE)
    public List<NotifyAttachmentView> findById(String notifyId) {
        NotifyAttachmentViewExample example=new NotifyAttachmentViewExample();
        NotifyAttachmentViewExample.Criteria criteria = example.createCriteria();
        criteria.andNotifyIdEqualTo(notifyId);
        return  notifyAttachmentViewMapper.selectByExample(example);
    }
}
